package com.example.bes013.web.demo.controller;

import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@Slf4j
public class TestController {

    @GetMapping(value = "/")
    public String hello(String param) throws InterruptedException {
        log.info("welcome to use bes");
        return "welcome  ~~~";
    }

    @GetMapping(value = "/header")
    public Map header(@RequestHeader Map<String, String> headers) {

        for (Map.Entry<String, String> entry : headers.entrySet()) {
            System.out.println("参数名称：" + entry.getKey() + "，值：" + entry.getValue());
        }
        return headers;
    }
}
